package com.sweet.fourtimeoa.mapper;

import com.sweet.fourtimeoa.pojo.dto.*;
import com.sweet.fourtimeoa.pojo.entity.*;
import com.sweet.fourtimeoa.pojo.vo.IncomeProofApplicationsAndUsers;
import com.sweet.fourtimeoa.pojo.vo.LeaveApplicationsAndUsersVo;
import com.sweet.fourtimeoa.pojo.vo.TravelApplicationsAndUsers;
import com.sweet.fourtimeoa.pojo.vo.VehicleUsageAndVehicleManagementAndUsers;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 我的桌面
 */

public interface DesktopMapper {
    //待处理任务——查询

    //我的便签-查询
    List<Notes> getNotesList(Integer userId);

    //我的便签-添加
    boolean addNotes(Notes notes);

    //我的便签-删除
    boolean deleteNotes(Integer noteId);

    //我的便签-修改
    boolean updateNotes(Notes notes);

    //通告管理-首页查询所有
    List<Announcements> getAnnouncementsList();

    //待处理任务-请假申请分页查询-条件查询
    List<LeaveApplicationsAndUsersVo> queryLeaveApplicationsAndUsers(LeaveApplicationsAndUsersDto leaveApplicationsAndUsersDto);
    //待处理任务-出差申请分页查询
    List<TravelApplicationsAndUsers> queryTravelApplicationsAndUsers(TravelApplicationsAndUsersDto travelApplicationsAndUsersDto);
    //待处理任务-收入证明申请分页查询
    List<IncomeProofApplicationsAndUsers> queryIncomeProofApplicationsAndUsers(IncomeProofApplicationsAndUsersDto IncomeProofApplicationsAndUsersDto);
    //待处理任务-用车申请分页查询
    List<VehicleUsageAndVehicleManagementAndUsers> queryVehicleUsageAndVehicleManagementAndUsers(VehicleUsageAndVehicleManagementAndUsersDto vehicleUsageAndVehicleManagementAndUsersDto);
    //待处理任务-用章申请分页查询
    List<SealManagement> querySealManagement(SealManagementDto sealManagementDto);
    //待处理任务-图书预约申请分页查询
    List<BookBorrowing> queryBookBorrowing(BookBorrowingDto bookBorrowingDto);
    //待处理任务-名片打印申请分页查询
    List<BusinessCardPrinting> queryBusinessCardPrinting(BusinessCardPrintingDto businessCardPrintingDto);







    //根据id查看对应显示的修改信息
    LeaveApplicationsAndUsersVo LookUpdateLeaveApplicationsAndUsersList(Integer applicationId);//请假
    TravelApplicationsAndUsers LookUpdateTravelApplicationsAndUsersList(Integer applicationId);//出差
    IncomeProofApplicationsAndUsers LookUpdateIncomeProofApplicationsAndUsersList(Integer applicationId);//收入
    VehicleUsageAndVehicleManagementAndUsers LookUpdateVehicleUsageAndVehicleManagementAndUsers(Integer usageId);//用车
    SealManagement LookUpdateSealManagementList(Integer id);//用章
    BookBorrowing LookUpdateBookBorrowingList(Integer id);//图书
    BusinessCardPrinting LookUpdateBusinessCardPrintingList(Integer id);//名片



    //根据id修改申请状态
    //请假
    boolean UpdateStatusLeaveApplicationsAndUsersList(LeaveApplicationsAndUsersVo leaveApplicationsAndUsersVo);//请假






    //待处理任务-请假申请查询所有
    List<LeaveApplicationsAndUsersVo> getLeaveApplicationsAndUsersList();
    //待处理任务-出差申请查询所有
    List<TravelApplicationsAndUsers> getTravelApplicationsAndUsersList();
    //待处理任务-收入证明流程查询所有
    List<IncomeProofApplicationsAndUsers> getIncomeProofApplicationsAndUsersList();
    //待处理任务-用车申请查询所有
    List<VehicleUsageAndVehicleManagementAndUsers> getVehicleUsageAndVehicleManagementAndUsers();
    //待处理任务-用章申请查询所有
    List<SealManagement> getSealManagementList();
    //待处理任务-图书申请查询所有
    List<BookBorrowing> getBookBorrowingList();
    //待处理任务-名片印制查询所有
    List<BusinessCardPrinting> getBusinessCardPrintingList();





    //获取待处理数据个数
    //请假
    @Select("select count(status)\n" +
            "        from leave_applications\n" +
            "        where status = '待处理'\n" +
            "           or status = 'pending'")
    Integer countLeave();
    //出差
    @Select("select count(status)\n" +
            "        from business_card_printing\n" +
            "        where status = '待处理'\n" +
            "           or status = 'pending'\n" +
            "           or status = 'PENDING'")
    Integer countBusinessCar(); //名片
    //收入
    @Select("    select count(status)\n" +
            "        from income_proof_applications\n" +
            "        where status = '待处理'\n" +
            "           or status = 'pending'")
    Integer countIncomeProof(); //收入
    //用车
    @Select("   select count(status)\n" +
            "        from vehicle_usage\n" +
            "        where status = '待处理'\n" +
            "           or status = 'pending'\n" +
            "           or status = 'PENDING'")
    Integer countVehicleUsageAndVehicle(); //用车
    //用章
    @Select(" select count(status)\n" +
            "        from seal_management\n" +
            "        where status = '待处理'\n" +
            "           or status = 'pending'\n" +
            "           or status = 'PENDING'")
    Integer countSeal(); //用章
    //图书
    @Select(" select count(status)\n" +
            "        from book_borrowing\n" +
            "        where status = '待处理'\n" +
            "           or status = 'pending'\n" +
            "           or status = 'PENDING'")
    Integer countBook(); //图书
    //名品啊
    @Select(" select count(status) from travel_applications where status = '待处理' or status = 'pending'")
    Integer countT();
}
